﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;

/// <summary>
/// car 的摘要说明
/// </summary>
public class car : SQLHelper
{
    //定义kh类的数据成员（属性）
    private string cnum;
    private string ccolor;
    private string cnamegys;
    private string cprice;
    private string cdateout;
    private string cdatein;
    private string ccknum;
    private string ctype;
    private string cuse;
    private string csize;
    private string cpower;
    
    public string num
    {
        get { return cnum; }
        set { cnum = value; }
    }
    public string color
    {
        get { return ccolor; }
        set { ccolor = value; }
    }
    public string namegys
    {
        get { return cnamegys; }
        set { cnamegys = value; }
    }
    public string price
    {
        get { return cprice; }
        set { cprice = value; }
    }
    public string dateout
    {
        get { return cdateout; }
        set { cdateout = value; }
    }
    public string datein
    {
        get { return cdatein; }
        set { cdatein = value; }
    }
    public string cknum
    {
        get { return ccknum; }
        set { ccknum = value; }
    }
    public string type
    {
        get { return ctype; }
        set { ctype = value; }
    }
    public string use
    {
        get { return cuse; }
        set { cuse = value; }
    }
    public string size
    {
        get { return csize; }
        set { csize = value; }
    }
    public string power
    {
        get { return cpower; }
        set { cpower = value; }
    }
  
   
   
	public car()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
	}
    public int Addonecar(car tmp)
    {
        string sql = "insert into car(Cnum,Ccolor,Cnamegys,Cprice,Cdateout,Cdatein,Ccknum,Ctype,Cuse,Csize,Cpower) values('" + tmp.num +
            "','" + tmp.color +
            "','" + tmp.namegys +
            "','" + tmp.price +
            "','" + tmp.dateout +
            "','" + tmp.type +
            "','" + tmp.use +
            "','" + tmp.size +
            "','" + tmp.power +
           
            "','" + tmp.cknum + "')";
        int result = tmp.ExeNonQuery(sql);
        return result;
    }
    public int Deleteonecar(car tmp)
    {
        string sql = "delete from car where Cnum='" + tmp.num + "'";
        int result = tmp.ExeNonQuery(sql);
        return result;
    }
    public DataSet GetAllCar()
    {
        car tmp = new car();
        string sql = "select * from car";
        //,T_province,T_city where"
        //+
        //"t_users.u_PROVINCE=T_province.FID and T_province.FID=T_city.proID and "
        // +"t_users.u_city=T_city.FcityID";
        DataSet ds = tmp.GetDs(sql);
        return ds;
    }
    public int Updateonecar(car tmp)
    {
        string sql = "update car set Ccolor='" + tmp.color +
                "', Cnamegys= '" + tmp.namegys +
                "', Cprice= '" + tmp.price +
                "', Cdateout= '" + tmp.dateout +
                "', Cdatein= '" + tmp.datein +
                "', Ccknum= '" + tmp.cknum +
                "', Ctype= '" + tmp.type +
                "', Cuse= '" + tmp.use +
                "', Csize= '" + tmp.size +
                "' ,Cpower= '" + tmp.power +
              
                "' where Cnum= '" + tmp.num + "'";
        int result = tmp.ExeNonQuery(sql);
        return result;
    }
    
}